﻿using UnityEngine;
using System.Collections;

public class TestTex : MonoBehaviour {

	public Texture2D otex;
	Texture2D tex;
	Renderer red;
	Texture2D texb;
	Color[] col;
	void Start()
	{

		red = GetComponent<Renderer> ();
		tex = (Texture2D)red.material.mainTexture;
		texb = tex;
		col = otex.GetPixels ();
		tex.SetPixels (10, 10, 100, 100, col);
		tex.Apply ();
	}
	void FixedUpdate()
	{
		if (Input.GetMouseButton (0)) {
			red.material.mainTexture=(Texture)texb;
			Debug.Log("Replace Done");
		}
	}
}
